function loadmenu(){
    $("#MenuElement").load("defaultmenu.html");
//    $("#MenuElement").load("menu2.html");
}
function defaultmenu(){
    $("#MenuElement").load("defaultmenu.html");
}
function loadpopmenu(){
	//$("#popmenu").html("<div class='menuitem'><a href='#' onclick='msgs()'>1#变电站</a></div><div class='menuitem'><a href='#' onclick='msgs()'>2#变电站</a></div>");
    $("#popmenu").load("popmenutemplate/transformer_substation.html");
}
function popmenu(evt){
	var evt = evt||window.event;
		var rightedge = document.body.clientWidth-evt.clientX;  
		var bottomedge = document.body.clientHeight-evt.clientY;
		if(rightedge<popmenu.offsetWidth){ 
			document.getElementById("popmenu").style.left = document.body.scrollLeft + evt.clientX   - document.getElementById("popmenu").offsetWidth;  
		}else{
			document.getElementById("popmenu").style.left = document.body.scrollLeft + evt.clientX;  
			if(bottomedge   <document.getElementById("popmenu").offsetHeight){
				document.getElementById("popmenu").style.top = document.body.scrollTop + evt.clientY   - document.getElementById("popmenu").offsetHeight;  
			}else{
				document.getElementById("popmenu").style.top = document.body.scrollTop + evt.clientY;  
				document.getElementById("popmenu").style.visibility = "visible";  
			}
			return false;  
		}
}
function highlightpopmenu(evt){ 
    var evt_target = evt.target||window.event.srcElement;
	if(evt_target.className == "menuitems"){  
   		evt_target.style.background = "#eee";  
 		evt_target.style.color = "white";  
	}
}
function lowlightpopmenu(evt){  
    var evt_target = evt.target||window.event.srcElement;
  	if(evt_target.className == "menuitems"){  
  		evt_target.style.background = "#FFF";  
  		evt_target.style.color = "black";  
  	}
    //evt_target.style.visibility = "hidden";
}  

function hidepopmenu(){
	document.getElementById("popmenu").style.visibility = "hidden";  
}  

function msgs(msg){
    document.getElementById("popmenu").style.visibility = "hidden"; 
	alert(msg);
}

function select_map(){
    var dom = window.top.document.getElementById("main").contentWindow.document.body;
    alert($(dom).find("#maindiv > ul").html());
    $(dom).find("#maindiv > ul").tabs("select", 0);
}
function select_attribute(){
    var dom = window.top.document.getElementById("main").contentWindow.document.body;
    alert($(dom).find("#maindiv > ul").html());
    $(dom).find("#maindiv > ul").tabs("select", 1);
}
function showPosition(id){
    jQuery.noConflict();  
    var src = map_analysis(id);
	var dom = window.top.document.getElementById("main").contentWindow.document.body;
	//$(dom).find("#attribute").css("display","none");
	//$(dom).find("#map").css("display","block");
    //dom.example.map.innerHTML = "<img src='"+src+"' width='800px'/>";
	jQuery(dom).find("#map").html("<img src='"+src+"' width='800px'/>");
}

function showAttribute(id){
    jQuery.noConflict();  
	var template = node_analysis(id);
	var dom = window.top.document.getElementById("pop_window");//.contentWindow.document.body;
    
//	$(dom).find("#map").css("display","none");
//	$(dom).find("#attribute").css("display","block");
    jQuery(dom).find("#pop_background").css("display", "block");
    jQuery(dom).find("#pop_attribute").css("display", "block");
    //jQuery(dom).find("#pop_attribute").dialog();
	var attribute = jQuery(dom).find("#tabs_attribute").attr("src",template);//load("tab_template/tab.html");
}
function close_pop_window(){
    jQuery.noConflict();  
    var dom = window.top.document.getElementById("pop_window");
    jQuery(dom).find("#pop_background").css("display", "none");
    jQuery(dom).find("#pop_attribute").css("display", "none");
}